﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Degrade
{
    public class Setting
    {
        /// <summary>
        /// 界面的用户数据
        /// </summary>
        public Dictionary<string,Dictionary<string,string>> UserOper { get; set; }
        /// <summary>
        /// IP地址
        /// </summary>
        public List<Dictionary<string,string>> IP { get; set; }
        /// <summary>
        /// 根据cabinet查找IP的dict
        /// </summary>
        /// <param name="cabinet"></param>
        /// <returns></returns>
        public Dictionary<string,string> GetIPFromCabinet(string cabinet)
        {
            foreach (var item in IP)
            {
                if (cabinet.Trim().ToLower() == item["cabinet"].Trim().ToLower())
                {
                    return item;
                }
            }
            return null;
        }
    } 
}
